#include <iostream>
#include <vector>
using namespace std;

using ll = long;

int lowbit(int x)
{
	return x & (-x);
}

void add(vector<ll> &nums, int i, ll v)
{
	int n = nums.size() - 1;
	while (i <= n) {
		nums[i] += v;
		i += lowbit(i);
	}
}

ll sum(vector<ll> &nums, int i)
{
	ll ans = 0;
	while (i > 0) {
		ans += nums[i];
		i -= lowbit(i);
	}
	return ans;
}

ll query(vector<ll> &nums, int l, int r)
{
	return sum(nums, r) - sum(nums, l - 1);
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);

	int n, m;
	cin >> n >> m;
	vector<ll> nums(n + 1, 0);

	ll v = 0;
	for (int i = 1; i <= n; i++) {
		cin >> v;
		add(nums, i, v);
	}

	ll r = 0;
	for (int i = 0, op, l; i < m; i++) {
		cin >> op >> l >> r;
		if (op == 1) {
			add(nums, l, r);
		} else {
			cout << query(nums, l, r) << '\n';
		}
	}

	return 0;
}